{-
	Copyright (c) 2009 Aitor Lopez Fadrique <mailto:aitorlf@gmail.com>
	All rights reserved
	Licensed under GNU LGPL v2.1

	$Id: CekiDeck.hs 15 2009-09-28 21:16:23Z aitorlf $

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License version 2.1 (and just under that one) as published by
	the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but without any warranty; without even the implied warranty of
	merchantability or fitness for a particular purpose. See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this program; if not, write to the Free
	Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
	MA 02111-1307, USA.
-}

{-|
	Module		: Games.Cards.Deck.CekiDeck
	Copyright	: (c) Aitor Lopez Fadrique <mailto:aitorlf@gmail.com>
	License		: GNU LGPL v2.1 <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>

	Maintainer	: Aitor Lopez Fadrique <mailto:aitorlf@gmail.com>
	Stability	: provisional
	Portability	: portable

	Definition of the Ceki decks according to Games.Cards.Deck.

	This module defines the basic Ceki 30 cards deck together with the double-sized deck.
-}
module Games.Cards.Deck.CekiDeck(
		-- * Ceki deck
		-- ** Types defining cards and decks for the Ceki deck
		CekiRank(..),
		CekiSuit(..),
		CekiUnsuitedCards(..),
		CekiCard,
		CekiDeck,
		-- ** Instances of Ceki classic decks
		cekiSingleDeck,
		cekiDoubleDeck,
		cekiDeck,
	)where

import Games.Cards.Deck


-- | Well-known ranks for the classic Ceki deck.
data CekiRank =
		-- | 'One' (/1/)
		One
		-- | 'Two' (/2/)
		| Two
		-- | 'Three' (/3/)
		| Three
		-- | 'Four' (/4/)
		| Four
		-- | 'Five' (/5/)
		| Five
		-- | 'Six' (/6/)
		| Six
		-- | 'Seven' (/7/)
		| Seven
		-- | 'Eight' (/8/)
		| Eight
		-- | 'Nine' (/9/)
		| Nine
	deriving (Eq, Ord, Enum, Bounded, Show, Read)
instance CardRank CekiRank


-- | Well-known suits for the Ceki deck.
data CekiSuit =
		-- | 'Coins'
		Coins
		-- | 'Strings'
		| Strings
		-- | 'Myriads'
		| Myriads
	deriving (Eq, Enum, Bounded, Show, Read)
instance CardSuit CekiSuit


-- | Special Ceki cards are treated as @'WildCard'@s to be automatically managed by deck utilities.
data CekiUnsuitedCards =
		-- | 'OldThousand'
		OldThousand
		-- | 'RedFlower'
		| RedFlower
		-- | 'WhiteFlower'
		| WhiteFlower
	deriving(Eq, Enum, Bounded, Show, Read)
-- Trivial instanciation to be available as @'WildCard'@, returning the full sequence of available values.
instance WildCard CekiUnsuitedCards where
	wildcardSet = [minBound .. maxBound]


-- | Definition of the Ceki @'Card'@s and @'Deck'@s.

-- | Ceki card type.
type CekiCard = Card CekiRank CekiSuit CekiUnsuitedCards

-- | Ceki deck type.
type CekiDeck = Deck CekiRank CekiSuit CekiUnsuitedCards

-- | Ceki single deck instance.
cekiSingleDeck :: CekiDeck
cekiSingleDeck = deck

-- | Ceki double deck instance.
cekiDoubleDeck :: CekiDeck
cekiDoubleDeck = multipleDecks 2

-- | Ceki deck instance.
cekiDeck :: CekiDeck
cekiDeck = cekiDoubleDeck
